package cn.tedu.management.portal.controller;


import cn.tedu.management.portal.model.Job;
import cn.tedu.management.portal.service.IJobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tedu.cn
 * @since 2020-12-08
 */
@RestController
@RequestMapping("/portal/job")
public class JobController {

    @Autowired
    IJobService jobService;
// http://localhost:8080/portal/job/select
    @GetMapping("/select")
    public List<Job> findJobController(){
        List<Job> list =jobService.getJobList();
        return list;
    }

    // http://localhost:8080/portal/job/insert?name="12125"
    @GetMapping("/insert")
    public String insert(String name){
         jobService.insert(name);
         return "添加成功";
    }

    // http://localhost:8080/portal/job/update?id=4&jobName=人事部
    @GetMapping("/update")
    public String update(Integer id, String jobName){
        jobService.update(id,jobName);
        return "修改成功";
    }

}
